<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24
 * Time: 8:30
 */

namespace app\ext\service;


use app\ext\model\TodoModel;

class TodoService extends BaseService
{
    public function addTodo()
    {
        $content =  input('content');

        $data = [
            'content'       =>  $content,
            'add_time'      =>  time(),
            'u_id'          =>  0
        ];
        $todoModel = new TodoModel();
        return $res = $todoModel->add($data);
    }

    public function todoList($page = 1,$limit = 10)
    {
        $todoModel = new TodoModel();
        $list = $todoModel->todoList($page,$limit);
        return $list;
    }

    public function del()
    {
        $id = input('id')?:0;
        $todoModel = new TodoModel();
        return $todoModel->del($id);
    }
}